package bdz.projects.atwww.electrolux.views.digital
{
	import bdz.projects.atwww.electrolux.ui.ELRotaryControl;
	import bdz.projects.atwww.electrolux.views.digital.support.ELDigitalIcon;
		
	public class ELDigitalRotary extends ELRotaryControl {
		private var _icons:Array;
		private var _prev:ELDigitalIcon;
		private var _prevrun:ELDigitalIcon;
		public function ELDigitalRotary() {
			
			super(105, new DigitalRotaryHandler());
			
		}
		override protected function initializeComponent():void{
			_customBase = this["customRoller"];
			_customBase.buttonMode = _customBase.useHandCursor = true;
			super.initializeComponent();
			_icons = [this["favourites"],this["delicates"],this["heavy_duty"],this["colours"],this["woollens"],this["handwash"],this["bedding"],this["rinse_spin"],this["drain_spin"], this["cold"],this["regular"],this["fast"]];
			for each(var mc:ELDigitalIcon in _icons){
				mc.mouseChildren = mc.mouseEnabled = false;
			}
			_rotateSpeed = 0;
			
		}
		override protected function handleRotations():void{
			super.handleRotations();
			if(_prevrun){
				_prevrun.revert();
			}
			for each(var ei:ELDigitalIcon in _icons){
				ei.revert();
			
			}
			_icons[_rotationValue/_degreeIncrement].highlight();
			_prevrun = _icons[_rotationValue/_degreeIncrement];
		}
		override protected function onRotationComplete():void{
			for each(var ei:ELDigitalIcon in _icons){
				ei.revert();
			
			}
			if(_prev){
				_prev.revert();
			}
			_icons[_rotationValue/_degreeIncrement].highlight();
			_prevrun = _prev = _icons[_rotationValue/_degreeIncrement];
			super.onRotationComplete();
		}
	}
}